package com.project.isaacwiki.mapper;

import com.project.isaacwiki.pojo.ImgPath;
import com.project.isaacwiki.pojo.Users;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface MapperUserOpera {

    @Select("select * from users where id = #{id}")
    Users queryUserById(Integer id);

    @Update("update img_path set path = #{imgUrl} where user_id = #{id}")
    Integer updateImage(String imgUrl, Integer id);

    @Update("update users set name = #{name} where id = #{id}")
    Integer updateUserInfo(String name, Integer id);

    @Select("select * from img_path where user_id = #{id}")
    ImgPath queryImage(Integer id);

    @Update("update users set password = #{newPassword} where id = #{id} and password = #{oldPassword}")
    Integer updateUserPasswordById(Integer id, String oldPassword, String newPassword);
}
